if '__main__' == __name__:
    
    import wandb
    import json
    import os
    from PyCmpltrtok.common import get_dir_name_ext
    
    XDIR, XBASE, XEXT = get_dir_name_ext(os.path.abspath(__file__))

    api = wandb.Api()
    run = api.run("cmpltrtok20-rayootech/huggingface/runs/gvsnlx6b")
    history = run.history()
    print(history)
    json_txt = history.to_json(orient='records')
    path = os.path.join(XDIR, f'{XBASE}.tmp.json')
    parsed = json.loads(json_txt)
    with open(path, 'w') as f:
        json.dump(parsed, f)
    